/*
******************************************************************************************************* 
**  Copyright (C) 2019,  
**  All rights reserved. 
** 
**  FileName:       	uart.h
**  Description:	
**  Author:        	 
**  Version				v0.1
**  Date:           	2019-05-22
**	Function List�� 
**  History:         
*********************************************************************************************************
*/
/*
*********************************************************************************************************
*                                              	��ֹ�ظ�����
*********************************************************************************************************
*/

#ifndef _BSP_CFG_H_
#define _BSP_CFG_H_
/*
*********************************************************************************************************
*                                              	���Կ���
*********************************************************************************************************
*/



/*
*********************************************************************************************************
*                                              	ͷ�ļ�
*********************************************************************************************************
*/

#include "stm32h7xx.h"
#include "stm32h7xx_hal.h"
#include "system_cfg.h"
/*
*********************************************************************************************************
*                                              	Ƭ��BSP�궨��
*********************************************************************************************************
*/
/*ͨѶ���ߺ�DMA���*/
#define UART1_TX_DMA_STREAM		DMA1_Stream0
#define UART1_RX_DMA_STREAM		DMA1_Stream1

#define UART2_TX_DMA_STREAM		DMA1_Stream2
#define UART2_RX_DMA_STREAM		DMA1_Stream3

#define UART6_TX_DMA_STREAM		DMA1_Stream4
#define UART6_RX_DMA_STREAM		DMA1_Stream5

#define UART4_TX_DMA_STREAM		DMA1_Stream6
#define UART4_RX_DMA_STREAM		DMA1_Stream7

#define UART3_TX_DMA_STREAM		DMA2_Stream0
#define UART3_RX_DMA_STREAM		DMA2_Stream1

#define UART7_TX_DMA_STREAM		DMA2_Stream2
#define UART7_RX_DMA_STREAM		DMA2_Stream3

#define UART8_TX_DMA_STREAM		DMA2_Stream6
#define UART8_RX_DMA_STREAM		DMA2_Stream7

#define SPI5_TX_DMA_STREAM		DMA2_Stream4
#define SPI5_RX_DMA_STREAM		DMA2_Stream5

#define SPI5_TX_DMA_IRQ				DMA2_Stream4_IRQn
#define SPI5_RX_DMA_IRQ				DMA2_Stream5_IRQn

#define SPI5_TX_DMA_IRQ_HANDLER				DMA2_Stream4_IRQHandler
#define SPI5_RX_DMA_IRQ_HANDLER				DMA2_Stream5_IRQHandler

#define W25Q128_SPI_CHANNEL						SPI5
#define W25Q128_SPI_CS_GPIO_BASE			GPIOF
#define W25Q128_SPI_CS_GPIO_PIN				GPIO_PIN_6
#define W25Q128_SPI_WP_GPIO_BASE			GPIOF
#define W25Q128_SPI_WP_GPIO_PIN				GPIO_PIN_10

#define UART7_485DE_GPIO_BASE					GPIOE
#define UART7_485DE_GPIO_PIN					GPIO_PIN_9

#define USART3_422DE_GPIO_BASE				GPIOB		
#define USART3_422DE_GPIO_PIN					GPIO_PIN_15
#define USART3_422RE_GPIO_BASE				GPIOD	
#define USART3_422RE_GPIO_PIN					GPIO_PIN_10

#define AT24C02_IIC_BASE							I2C2

/*74HC595��عܽ�*/
/*���������*/
#define VALVE_HC595_DATA_BASE					GPIOD
#define VALVE_HC595_DATA_PIN					GPIO_PIN_13
#define VALVE_HC595_CLK_BASE					GPIOD
#define VALVE_HC595_CLK_PIN						GPIO_PIN_12
#define VALVE_HC595_RCLK_BASE					GPIOD
#define VALVE_HC595_RCLK_PIN					GPIO_PIN_11
#define VALVE_HC595_OE_BASE						GPIOB
#define VALVE_HC595_OE_PIN						GPIO_PIN_14
/*ֱ����� ��*/
#define DCMOTOR_HC595_DATA_BASE					GPIOD
#define DCMOTOR_HC595_DATA_PIN					GPIO_PIN_14
#define DCMOTOR_HC595_CLK_BASE					GPIOG
#define DCMOTOR_HC595_CLK_PIN						GPIO_PIN_3
#define DCMOTOR_HC595_RCLK_BASE					GPIOG
#define DCMOTOR_HC595_RCLK_PIN					GPIO_PIN_2
#define DCMOTOR_HC595_OE_BASE						GPIOD
#define DCMOTOR_HC595_OE_PIN						GPIO_PIN_15
/*ֱ��PWM*/
#define DCMOTOR1_EN_BASE								GPIOD
#define DCMOTOR1_EN_PIN									GPIO_PIN_4
#define DCMOTOR2_EN_BASE								GPIOD
#define DCMOTOR2_EN_PIN									GPIO_PIN_3
#define DCMOTOR3_EN_BASE								GPIOA
#define DCMOTOR3_EN_PIN									GPIO_PIN_8
#define DCMOTOR4_EN_BASE								GPIOG
#define DCMOTOR4_EN_PIN									GPIO_PIN_8
#define DCMOTOR5_EN_BASE								GPIOG
#define DCMOTOR5_EN_PIN									GPIO_PIN_4
#define DCMOTOR6_EN_BASE								GPIOG
#define DCMOTOR6_EN_PIN									GPIO_PIN_5
#define DCMOTOR7_EN_BASE								GPIOG
#define DCMOTOR7_EN_PIN									GPIO_PIN_6
#define DCMOTOR8_EN_BASE								GPIOG
#define DCMOTOR8_EN_PIN									GPIO_PIN_7

/*�ź�����*/
#define SENSER1_BASE				GPIOE
#define SENSER1_PIN					GPIO_PIN_2
#define SENSER2_BASE				GPIOE
#define SENSER2_PIN					GPIO_PIN_3
#define SENSER3_BASE				GPIOE
#define SENSER3_PIN					GPIO_PIN_4
#define SENSER4_BASE				GPIOE
#define SENSER4_PIN					GPIO_PIN_5
#define SENSER5_BASE				GPIOE
#define SENSER5_PIN					GPIO_PIN_6
#define SENSER6_BASE				GPIOF
#define SENSER6_PIN					GPIO_PIN_3
#define SENSER7_BASE				GPIOF
#define SENSER7_PIN					GPIO_PIN_4
#define SENSER8_BASE				GPIOF
#define SENSER8_PIN					GPIO_PIN_5
#define SENSER9_BASE				GPIOC
#define SENSER9_PIN					GPIO_PIN_0
#define SENSER10_BASE				GPIOA
#define SENSER10_PIN				GPIO_PIN_3
#define SENSER11_BASE				GPIOA
#define SENSER11_PIN				GPIO_PIN_4
#define SENSER12_BASE				GPIOA
#define SENSER12_PIN				GPIO_PIN_5

/*74HC165 ����ת����*/
#define	BTN_HC165_DATA_BASE					GPIOB
#define	BTN_HC165_DATA_PIN					GPIO_PIN_2
#define	BTN_HC165_CLK_BASE					GPIOF
#define	BTN_HC165_CLK_PIN						GPIO_PIN_12
#define	BTN_HC165_SHIFT_BASE				GPIOF
#define	BTN_HC165_SHIFT_PIN					GPIO_PIN_14


/*74HC595�ƴ�����ת�������*/
#define LED_HC595_OE_BASE						GPIOG
#define LED_HC595_OE_PIN						GPIO_PIN_0
#define LED_HC595_RCLK_BASE					GPIOE
#define LED_HC595_RCLK_PIN					GPIO_PIN_10
#define LED_HC595_CLK_BASE					GPIOE
#define LED_HC595_CLK_PIN						GPIO_PIN_12
#define LED_HC595_DATA_BASE					GPIOE
#define LED_HC595_DATA_PIN					GPIO_PIN_14
/*
*********************************************************************************************************
*                                              ���ذ��������ú궨��
*********************************************************************************************************
*/
#define LOG_CONSOLE_UART_CHN		USART2

#define BARCODE_CR100_UART_CHN	USART1

#define QRCODE_DCR55_UART_CHN		USART6
/*ȥ����Һ�;ͼ�צ ʹ����˼�׼�צ*/
#define USE_STDL_PLUNGER

// #ifdef USE_STDL_PLUNGER
#define PLUNGER_UART_CHN				USART3
#define RFID_UART_CHN						USART6
// #else
// #define PLUNGER_UART_CHN				USART3
// #define RFID_UART_CHN						USART3
// #endif
#define PMT_UART_CHN						UART4

#define CLAW_UART_CHN						UART7
#define MISUMI_CLAW_CHN					UART7

#define _4G_MOD_UART_CHN				UART8
#define _4G_MOD_DEBUG_CHN				USART6
//#define EFG_CLAW_UART_CHN				USART3 /*USART7*/
/*moons �ŷ����ͨѶ��*/
#define MOONS_SERVO_UART				USART3

/*CAN ������ض���*/
#define MOTOR_CAN_CHN						FDCAN1
#define MOTOR_CAN_ID						0
#if PRODUCT_NAME_IVD_900 | MOTOR_CAN_250K
#define MOTOR_CAN_BAUDRATE			250
#else
#define MOTOR_CAN_BAUDRATE			1000
#endif
///*��������ģ���IO������ض���*/
//#define IO_CAN_CHN							FDCAN2
//#define IO_CAN_ID								0
//#define IO_BOARD_CAN_ID					0x7F0
/*�����ǵ����ص�CAN�豸����CAN2��*/
#define PERIPH_CAN_CHN							FDCAN2
#define PERIPH_CAN_ID								0
#if PERIPH_CAN_250K
#define PERIPH_CAN_BAUDRATE					250
#else
#define PERIPH_CAN_BAUDRATE					1000
#endif


/*
*********************************************************************************************************
*                                              	ȫ�ֱ�������
*********************************************************************************************************
*/

/*
*********************************************************************************************************
*                                              	��������
*********************************************************************************************************
*/

#endif
